-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Waterlog Mouse class with common operations #33
base: main
Are you sure you want to change the base?
Conversation
restriction: SlimsWaterRestrictionEvent | ||
all_restrictions: list[SlimsWaterRestrictionEvent] | ||
|
||
def __init__(self, barcode: str, user: SlimsUser, slims_client=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe user can be a union of string username or SlimsUser?
self._fetch_data() | ||
self._fetch_pks() | ||
|
||
def _fetch_data(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can implement these as properties and lazily fetch them. I can anticipate this class being used to get more than just water-related information; behavior sessions, surgical procedures, etc. Maybe it's not good to do all these fetches on instance init.
): | ||
"""Creates and adds a new waterlog weight/water record to SLIMS, and | ||
updates self.waterlog_results accordingly""" | ||
if total_water is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is total water ever going to not be water_supplement_delivered + water_earned?
Collects common operations into a class that can be used instead of juggling different records. Probably a useful pattern in other cases as well.